#!/usr/local/bin/python3.8
import json
import os
if __name__ == '__main__':
    # 不同的题型使用不同的策略
    with open('database.json', 'r') as f:
        database = json.loads(f.read())
    print(f"读取完成!共有{len(database)}条记录")
    while True:
        kw1 = input()
        # 直接5字母查询
        for k in database.keys():
            if kw1 in k:
                print(f"**************单词:{k}***************")
                print("——————————————————意思:")
                for item in database[k]:
                    print(item['content']['mean'])
                print("——————————————————用法:")
                for item in database[k]:
                    for item1 in item['content']['usage']:
                        print(item1)
                print("——————————————————例句:")
                for item in database[k]:
                    print(f"$$$$$$$$$$$$$$$$$$$$${item['content']['mean']}")
                    for item3 in item['content']['example']:
                        print(item3['sen_content'])
                    for item3 in item['content']['example']:
                        print(f"$$$$$$$$$$$$$$$$$$$$${item['content']['mean']}")
                        print(item3['sen_content'])

# 我们应该实现一个万能查询 这样能适应抓包的需求